import { Pipe, PipeTransform } from '@angular/core';

/**
 * 替换身份证号码中间四位变成*
 */
@Pipe({
  name: 'identity',
})
export class IdentityPipe implements PipeTransform {
  /**
   * @Input: {{'110101199001010001' | identity}}
   * @Output: 110101****0001
   */
  transform(value: string) {
    const reg = /^(.{6})(?:\d+)(.{4})$/;
    return value.replace(reg, "$1****$2");
  }
}
